﻿using System;
using Roslyn.Compilers.CSharp;

namespace BITS.PreCompiler.CSharp.Syntax.Extensions
{
    public static class TypeExtension
    {
        public static T WithTypeParameter<T>(this T @this, String name)
            where T : IType<TypeDeclarationSyntax>
        {
            if (String.IsNullOrEmpty(name))
                return @this;

            @this.AddTypeParameter(name);

            return @this;
        }

        public static T WithTypeParameter<T>(this T @this, Interface type)
            where T : IType<TypeDeclarationSyntax>
        {
            @this.AddTypeParameter(type);

            return @this;
        }

        public static T WithTypeParameter<T>(this T @this, Class type)
            where T : IType<TypeDeclarationSyntax>
        {
            @this.AddTypeParameter(type);

            return @this;
        }
    }
}
